package acwing.lq.递归and递推;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;

/**
 * @description:
 * @author: qian
 * @createDate: 2021/11/18
 */
public class 飞行员兄弟 {

    static int N = 4;
    static String[][] g = new String[N][N];
    static String[][] backup = new String[N][N];
    static ArrayList<Point> list = new ArrayList<Point>();

    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        // 初始化
        for (int i = 0; i < 4; i++) {
            g[i] = reader.readLine().split("");
        }
        // copy 要枚举2^16 种方案
        for (int i =0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                backup[i][j] = g[i][j];
            }
        }

        // 枚举所有方案
        for(int start = 0; start < 1 << 16; start++) {
            ArrayList<Point> temp = new ArrayList<>();
            boolean flag = true;
            for (int i = 0; i < 4; i++) {
                for (int j = 0; j < 4; j++) {
                    // 按一下开关
                    if ((start >> get(i, j) & 1 ) == 1) {
                        turnAll(i, j);
                        temp.add(new Point(i, j));
                    }
                }
            }
            // 判断是否全开
            for (int i = 0; i < 4; i++) {
                for (int j = 0; j < 4; j++) {
                    if (g[i][j].equals("+")) {
                        flag = false;
                        break;
                    }
                }
            }
            // 更新
            if (flag) {
                if (list.isEmpty() || temp.size() < list.size()) {
                    list = temp;
                }
            }
            // 还原数组
            for (int i = 0; i < 4; i++) {
                for (int j = 0; j < 4; j++) {
                    g[i][j] = backup[i][j];
                }
            }
        }
        System.out.println(list.size());
        for (Point p : list) {
            System.out.println(p);
        }
    }

    private static void turnAll(int x, int y) {

        for (int i = 0; i < 4; i++) {
            // 交换横坐标
            turnOne(x,i);
            // 交换纵坐标
            turnOne(i,y);
        }
        // 交换这个点
        turnOne(x, y);
    }

    private static void turnOne(int x, int y) {
        if (g[x][y].equals("+")) g[x][y] = "-";
        else  g[x][y] = "+";
    }

    private static int get(int i, int j) {

        return i * 4 + j;
    }
}
class Point {

    int x, y;

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public String toString() {
        return (x + 1) + " " + (y + 1);
    }
}